imagesid=`docker images |grep 'ns-datum' | awk '{print $3}'`
if [ ! $imagesid ]; then
    imagesid=`docker images |grep none | awk '{print $3}'`
fi
if [ $imagesid ]; then
    containerid=`docker ps |grep $imagesid|awk '{print $1}'`
    if [ $containerid ]; then
        echo "start"
        docker rm -f $containerid
        docker rmi -f  $imagesid
    else
        containerid=`docker ps |grep 'ns-datum:latest'|awk '{print $1}'`
        if [ $containerid ]; then
           docker rm -f $containerid
        fi
        docker rmi -f  $imagesid
    fi
fi